package cn.edu.pku.tools;

import java.util.Calendar;
import java.util.Date;

/**
 * @author vector
 *
 */
public class RegistrationInfo {

	String hospital_name;
	String doctor_name;
	Date date;
	String week;
	String time;
	Long id;
	String position, captcha, department;
	String[] weekName = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
	public RegistrationInfo(Long id, String hospital_name, String doctor_name, Date date, String week, String time, String position, String captcha, String department) {
		this.id = id;
		this.hospital_name = hospital_name;
		this.doctor_name = doctor_name;
		this.date = date;
		this.week = week;
		this.time = time;
		this.position = position;
	    this.captcha = captcha;
	    this.department = department;
	}
	
	public String getCaptcha()
	  {
	    return this.captcha;
	  }

	  public Long getDataId()
	  {
	    return this.id;
	  }

	  public String getDate()
	  {
	    int i = 1900 + this.date.getYear();
	    int j = 1 + this.date.getMonth();
	    int k = this.date.getDay();
	    Calendar localCalendar = Calendar.getInstance();
	    localCalendar.setTime(this.date);
	    String str = this.weekName[localCalendar.get(Calendar.DAY_OF_WEEK)];
	    return i + "年" + j + "月" + k + "日" + " " + str;
	  }

	  public String getDocDetail()
	  {
	    return this.hospital_name + " " + this.department + " " + this.position;
	  }

	  public String getDocInfo()
	  {
	    return this.hospital_name + " " + this.doctor_name + " " + this.position;
	  }

	  public String getDoctorName()
	  {
	    return this.doctor_name;
	  }

	  public long getId()
	  {
	    int i = 1900 + this.date.getYear();
	    return 1 + this.date.getMonth() + i * 100;
	  }

	  public int getLeftDay()
	  {
	    isEnd();
	    return 0;
	  }

	  public String getLeftTime()
	  {
	    return "已结束";
	  }

	  public String getMonthDay()
	  {
	    int i = 1 + this.date.getMonth();
	    int j = this.date.getDay();
	    return i + "月" + j + "日";
	  }

	  public String getSmallTime()
	  {
	    Calendar localCalendar = Calendar.getInstance();
	    localCalendar.setTime(this.date);
	    int i = localCalendar.get(11);
	    int j = localCalendar.get(12);
	    if (i <= 12)
	    	this.time = ("上午 " + i + ":" + j);
	    else
	    	this.time = ("下午" + (i - 12) + ":" + j);
	      return this.time;
	  }

	  public String getTime()
	  {
	    Calendar localCalendar = Calendar.getInstance();
	    localCalendar.setTime(this.date);
	    String str = this.weekName[localCalendar.get(7)];
	    int i = localCalendar.get(11);
	    int j = localCalendar.get(12);
	    if (i <= 12)
	    	this.time = ("上午 " + i + ":" + j);
	    else
	    	this.time = ("下午" + (i - 12) + ":" + j);
	      return getMonthDay() + " " + str + " " + this.time;
	  }

	  public String getYearMonth()
	  {
	    int i = 1900 + this.date.getYear();
	    int j = 1 + this.date.getMonth();
	    return i + "年" + j + "月";
	  }

	  public boolean isEnd()
	  {
	    if (864000000L + this.date.getTime() > new Date().getTime())
	    	return false;
	    return true;
	  }
}
